package com.wpp.lagouserviceuser.service.remoteservice;

import com.wpp.core.result.ResultDTO;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author wpp25
 * @date 2021/5/17 22:06
 * @description：
 */
@Service
public class GetCodeRemoteService {

    @Resource
    private RestTemplate restTemplate;

    public void getCode() {
        ResultDTO<String> resultDTO = restTemplate.getForObject("http://service-code/api/code", ResultDTO.class);
        if (resultDTO.getSuccess()) {
            System.out.printf("getCode: %s %n",resultDTO.getData());
        }
    }
}
